<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('股票列表二')"/>
</head>
<style>
    .table td:hover {
        overflow: visible;
        white-space: normal;
    }
    .table td {
        word-wrap: break-word;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    p {
        text-align: left; /* 强制所有段落左对齐 */
    }
</style>

<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>

                        <li>
                            <label>股票名称：</label>
                            <input type="text" name="stockName"/>
                        </li>
                        <li>
                            <label>实：</label>
                            <select name="actualCirculationStatus"
                                    th:with="type=${@dict.getType('actual_circulation_status')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}" th:selected="${dict.dictValue == '0'}"></option>
                            </select>
                        </li>
                        <li>
                            <label>龙：</label>
                            <select name="dragonTopicsStatus"
                                    th:with="type=${@dict.getType('dragon_topics_status')}">
                                <option value="">请选择</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:board:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="system:board:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:board:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:board:export">
                <i class="fa fa-download"></i> 导出
            </a>
            <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:user:import">
                <i class="fa fa-upload"></i> 导入
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var detailFlag = [[${@permission.hasPermi('system:board:edit')}]];
    var editFlag = [[${@permission.hasPermi('system:board:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:board:remove')}]];
    var prefix = ctx + "system/main/board/two";

    $(function () {
        var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                importUrl: prefix + "/importData",
                detailUrl: prefix + "/detail/{id}",
                importTemplateUrl: prefix + "/importTemplate",
                modalName: "股票主板",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'mainId',
                        title: '主板ID',
                        visible: false
                    },
                    {
                        field: 'stockName',
                        title: '股票名称',
                    },
                    {
                        field: 'secondDragonTimeOne',
                        title: '壹',
                        sortable: true,
                        formatter: function (value, row, index) {
                            if (value === null || value === undefined || value === "" || value === "-") {
                                return value;
                            } else {
                                if (row.secondDragonDetailReasonOne === null || row.secondDragonDetailReasonOne === undefined || row.secondDragonDetailReasonOne === "" || row.secondDragonDetailReasonOne === "-") {
                                    var showValue = row.secondDragonDetailOne
                                    return $.table.tooltip(showValue, showValue.length, "open");
                                } else {
                                    var showValue = row.secondDragonDetailOne + " "+"【"+row.secondDragonDetailReasonOne+"】"
                                    return $.table.tooltip(showValue, row.secondDragonDetailOne.length, "open");
                                }
                            }
                        }
                    },
                    {
                        field: 'secondDragonTimeTwo',
                        title: '贰',
                        sortable: true,
                        formatter: function (value, row, index) {
                            if (value === null || value === undefined || value === "" || value === "-") {
                                return value;
                            } else {
                                if (row.secondDragonDetailReasonTwo === null || row.secondDragonDetailReasonTwo === undefined || row.secondDragonDetailReasonTwo === "" || row.secondDragonDetailReasonTwo === "-") {
                                    var showValue = row.secondDragonDetailTwo
                                    return $.table.tooltip(showValue, showValue.length, "open");
                                } else {
                                    var showValue = row.secondDragonDetailTwo + " "+"【"+row.secondDragonDetailReasonTwo+"】"
                                    return $.table.tooltip(showValue, row.secondDragonDetailTwo.length, "open");
                                }
                            }
                        }
                    },
                    {
                        field: 'secondDragonTimeThree',
                        title: '叁',
                        sortable: true,
                        formatter: function (value, row, index) {
                            if (value === null || value === undefined || value === "" || value === "-") {
                                return value;
                            } else {
                                if (row.secondDragonDetailReasonThree === null || row.secondDragonDetailReasonThree === undefined || row.secondDragonDetailReasonThree === "" || row.secondDragonDetailReasonThree === "-") {
                                    var showValue = row.secondDragonDetailThree
                                    return $.table.tooltip(showValue, showValue.length, "open");
                                } else {
                                    var showValue = row.secondDragonDetailThree + " "+"【"+row.secondDragonDetailReasonThree+"】"
                                    return $.table.tooltip(showValue, row.secondDragonDetailThree.length, "open");
                                }
                            }
                        }
                    },

                    {
                        field: 'dragonTimeOne',
                        title: '一',
                        sortable: true,
                        formatter: function (value, row, index) {
                            if (value === null || value === undefined || value === "" || value === "-") {
                                return value;
                            } else {
                                if (row.dragonDetailReasonOne === null || row.dragonDetailReasonOne === undefined || row.dragonDetailReasonOne === "" || row.dragonDetailReasonOne === "-") {
                                    var showValue = row.dragonDetailOne
                                    return $.table.tooltip(showValue, showValue.length, "open");
                                } else {
                                    var showValue = row.dragonDetailOne + " "+"【"+row.dragonDetailReasonOne+"】"
                                    return $.table.tooltip(showValue, row.dragonDetailOne.length, "open");
                                }
                            }
                        }
                    },

                    {
                        field: 'dragonTimeTwo',
                        title: '二',
                        sortable: true,
                        formatter: function (value, row, index) {
                            if (value === null || value === undefined || value === "" || value === "-") {
                                return value;
                            } else {
                                if (row.dragonDetailReasonTwo === null || row.dragonDetailReasonTwo === undefined || row.dragonDetailReasonTwo === "" || row.dragonDetailReasonTwo === "-") {
                                    var showValue = row.dragonDetailTwo
                                    return $.table.tooltip(showValue, showValue.length, "open");
                                } else {
                                    var showValue = row.dragonDetailTwo+ " "+"【"+row.dragonDetailReasonTwo+"】"
                                    return $.table.tooltip(showValue, row.dragonDetailTwo.length, "open");
                                }
                            }
                        }
                    },
                    {
                        field: 'dragonTimeThree',
                        title: '三',
                        sortable: true,
                        formatter: function (value, row, index) {
                            if (value === null || value === undefined || value === "" || value === "-") {
                                return value;
                            } else {
                                if (row.dragonDetailReasonThree === null || row.dragonDetailReasonThree === undefined || row.dragonDetailReasonThree === "" || row.dragonDetailReasonThree === "-") {
                                    var showValue = row.dragonDetailThree
                                    return $.table.tooltip(showValue, showValue.length, "open");
                                } else {
                                    var showValue = row.dragonDetailThree + " "+"【"+row.dragonDetailReasonThree+"】"
                                    return $.table.tooltip(showValue, row.dragonDetailThree.length, "open");
                                }
                            }
                        }
                    },
                    {
                        field: 'sectorMarkupSortStock',
                        title: '板',
                        sortable: true,
                        formatter: function (value, row, index) {
                            if (value === null || value === undefined || value === "" || value === "-") {
                                return value;
                            } else {
                                var html = [];
                                html.push('联');
                                html.push(value);
                                var aa = html.join('');
                                return $.table.tooltip(aa, 1, "openHtml");
                            }
                        }
                    },
                    {
                        field: 'actualCirculationValue',
                        title: '实',
                        sortable: true,
                        formatter: function (value, row, index) {
                            if (value === null || value === undefined || value === "") {
                                return value;
                            } else {
                                value = Math.floor(value);
                                return value;
                            }
                        }

                    },
                    {
                        field: 'concept',
                        title: '概',
                        sortable: true,
                        formatter: function (value, row, index) {
                            if (value === null || value === undefined || value === "") {
                                return value;
                            } else {
                                return $.table.tooltip(value, 3, "open");
                            }
                        }

                    },
                    {
                        field: 'limitUpReasonDetail',
                        title: '原',
                        sortable: true,
                        formatter: function (value, row, index) {
                            if (value === null || value === undefined || value === "" || value === "-") {
                                return value;
                            } else {
                                var html = [];
                                html.push(value);
                                var showValue = html.join('');
                                return $.table.tooltip(showValue, 50, "open");
                            }
                        }
                    },
                    {
                        title: '操作',
                        align:
                            'center',
                        formatter:

                            function (value, row, index) {
                                var actions = [];
                                actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.mainId + '\',\'' + 1300 + '\',\'' + 800 + '\')"><i class="fa fa-search"></i>详细</a>');
                                return actions.join('');
                            }
                    }
                    ,

                    {
                        visible: editFlag == 'hidden' ? false : true,
                        title:
                            '是否购买',
                        align:
                            'center',
                        formatter:

                            function (value, row, index) {
                                return statusTools(row);
                            }
                    }


                ]
            }
        ;
        $.table.init(options);
    });


    function batchStockMainBoardDetail() {

        $.modal.confirm("确认要生成主板股票细节表数据吗?", function () {
            location.href = prefix + "/batchStockMainBoardDetail";
            layer.msg('执行成功,正在生成代码请稍候…', {icon: 1});
        });
    }

    /* 是否购买显示 */
    function statusTools(row) {
        if (row.purchaseLevel == 1) {
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.mainId + '\')"></i> ';
        } else {
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.mainId + '\')"></i> ';
        }
    }

    /* 是否购买-停用 */
    function disable(mainId) {
        $.modal.confirm("确认要停用购买吗？", function () {
            $.operate.post(prefix + "/changeStatus", {"mainId": mainId, "purchaseLevel": 1});
        })
    }

    /* 是否购买启用 */
    function enable(mainId) {
        $.modal.confirm("确认要启用购买吗？", function () {
            $.operate.post(prefix + "/changeStatus", {"mainId": mainId, "purchaseLevel": 0});
        })
    }

</script>
</body>

<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <input type="checkbox" id="updateSupport" name="updateSupport"
                       title="如果登录账户已经存在，更新这条数据。">
                &nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i
                    class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>